class Solution(object):
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        if len(nums) == 1:
            return [nums]
        res = []
        for i in range(len(nums)):
            cur_num = nums[i]
            other_permutes = self.permute(nums[:i] + nums[i+1:])
            for one in other_permutes:
                res.append(one + [cur_num])
        return res
